<template>
  <div>
    <h3>全局变量测试</h3>
    <p>选项式API访问: {{ optionApiVersion }}</p>
    <p>组合式API访问: {{ compositionApiVersion }}</p>
  </div>
</template>

<script>
// 选项式API访问
export default {
  name: 'GlobalVarTest',
  data() {
    return {
      optionApiVersion: this.$version
    }
  }
}
</script>

<script setup>
// 组合式API访问
import { getCurrentInstance } from 'vue'
const instance = getCurrentInstance()
const compositionApiVersion = instance.proxy.$version
</script>
